<template>
  <div class="ordersManagement-detail views-container">
    <el-dialog
      @close="resetDialogFormData"
      :visible.sync="dialogTableVisible"
      custom-class="reset-pwd wlm-form-dialog dialog-table"
    >
      <div
        class="wlm-form"
        v-if="dialogTableVisible"
      >
        <div class="wlm-form-header wlm-dialog-fixheader">
          <span class="wlm-dialog-inlenr">{{formType == '1'?'商家发货':formType == '3'? '确认核销' :formType == '3-1'?'确认延期':formType=='5'?'退款':'-'}}</span>
        </div>
        <el-scrollbar wrap-class="scrollbar-wrapper">
          <div class="wlm-form-content">
            <div class="wlm-dialog-main">
              <div class="wlm-dialog-content">
                <el-form
                  ref="userForm"
                  :model="formFormatData.formData"
                  :rules="formFormatData.rules"
                  size="small"
                  label-width="120px"
                  class="retail-form"
                  label-position="right"
                >
                  <template v-if="formType === '1'">
                    <el-form-item label="审核状态">
                      <el-radio-group v-model="formFormatData.formData.status">
                        <el-radio label="0">同意</el-radio>
                        <!-- <el-radio label="1">不同意</el-radio> -->
                      </el-radio-group>
                    </el-form-item>
                    <!-- <el-form-item label="原因" prop="reason" v-if="formFormatData.formData.status === '1'">
                                        <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 4}" v-model.trim="formFormatData.formData.reason">
                                        </el-input>
                                    </el-form-item> -->
                    <el-form-item
                      label="默认快递公司"
                      prop="express_company"
                      v-if="formFormatData.formData.status=='0'"
                    >
                      <el-select
                        v-model="formFormatData.formData.express_company"
                        placeholder="请选择"
                      >
                        <el-option
                          v-for="(item,index) in expressList"
                          :key="index"
                          :label="item"
                          :value="item"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item
                      label="物流单号"
                      prop="express_no"
                      v-if="formFormatData.formData.status=='0'"
                    >
                      <el-input v-model.trim="formFormatData.formData.express_no">
                      </el-input>
                    </el-form-item>
                  </template>
                  <template v-if="formType === '3'">

                    <div
                      style="display:flex"
                      class="flex-row flex-justify-b"
                    >
                      <el-form-item
                        label=""
                        label-width="0"
                      >
                        <el-input
                          v-model="verificationSerch"
                          placeholder="请输入核销码"
                        >
                        </el-input>
                        <el-button
                          size="small"
                          type="primary"
                          style="margin-left:8px;"
                          @click="verificationGet"
                        >搜索</el-button>
                      </el-form-item>
                      <el-form-item
                        label=""
                        label-width="0"
                      >
                        <el-select
                          v-model="formFormatData.formData.bus_id"
                          placeholder="请选择核销商家"
                          v-if="$detail.goods[0].transport_type==50"
                        >
                          <el-option
                            v-for="item in formFormatData.formData.giftorder"
                            :key="item.id"
                            :label="item.name"
                            :value="item.id"
                          >
                          </el-option>
                        </el-select>
                      </el-form-item>

                      <!-- <el-select :disabled="!!formFormatData.api['editForm']['params']['id']" filterable v-model="formFormatData.formData.bus_id" placeholder="请选择或输入关键词搜索">
                                            <el-option v-for="item in shopData" :disabled="item.storenum==0" :key="item.value" :label="item.name" :value="item.id"></el-option>
                                        </el-select> -->
                    </div>
                    <el-form-item
                      label=""
                      label-width="0"
                      v-if="$detail.goods[0].transport_type==10"
                    >
                      <div style="display:flex;">
                        <div>
                          选择门店：
                        </div>
                        <div>
                          <el-select
                            v-model="formFormatData.formData.store_id"
                            placeholder="请选择门店"
                          >
                            <el-option
                              v-for="item in storeidData"
                              :key="item.id"
                              :label="item.name"
                              :value="item.id"
                            >
                            </el-option>
                          </el-select>
                        </div>
                      </div>

                    </el-form-item>
                    <el-table
                      :data="verificationData"
                      style="width: 100%"
                      @selection-change="verificationSelectionChange"
                    >
                      <el-table-column
                        type="selection"
                        width="55"
                      >
                      </el-table-column>
                      <el-table-column label="核销码">
                        <template slot-scope="scope">
                          <span>{{scope.row.code}}</span>
                        </template>
                      </el-table-column>
                      <el-table-column label="商品">
                        <template
                          slot-scope="scope"
                          v-if="scope.row.goods"
                        >
                          <span>{{scope.row.goods.goods_name}}</span>
                        </template>
                      </el-table-column>
                    </el-table>
                  </template>
                  <template v-if="formType === '3-1'">
                    <!-- {{verificationData[0].end_time}} -->
                    <el-form-item label="过期时间">
                      <span v-if="hasVarCode">{{verificationData[0]['end_time'] | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
                    </el-form-item>
                    <el-form-item label="延期时间">
                      <el-input
                        v-model.trim="formFormatData.formData.time[0]"
                        style="width:50px;"
                      >
                      </el-input>
                      <span>时</span>
                      <el-input
                        v-model.trim="formFormatData.formData.time[1]"
                        style="width:50px;"
                      >
                      </el-input>
                      <span>分</span>
                      <el-input
                        v-model.trim="formFormatData.formData.time[2]"
                        style="width:50px;"
                      >
                      </el-input>
                      <span>秒</span>
                    </el-form-item>
                  </template>
                    <template v-if="formType === '5'">
                    <el-form-item label="是否退款">
                      <el-radio-group v-model="formFormatData.formData.refund_type">
                        <el-radio label="1">直接退款</el-radio>
                        <el-radio
                          label="2"
                          :disabled="is_abnormal==1?true:false"
                        >自定义</el-radio>
                      </el-radio-group>
                    </el-form-item>
                    <el-form-item
                      label="订单退款处退款方式"
                      v-if="formFormatData.formData.refund_root"
                    >
                      <el-radio-group
                        v-model="formFormatData.formData.refund_root"
                        style="margin-left:20px;"
                      >
                        <el-radio label="1">退款至余额</el-radio>
                        <el-radio label="2">原路返回</el-radio>
                        <el-radio label="3">默认</el-radio>
                      </el-radio-group>
                    </el-form-item>
                   
                    <el-form-item
                      label="自定义退款金额"
                      v-if="formFormatData.formData.refund_type=='2'"
                    >
                      <el-input
                        v-model.trim="formFormatData.formData.refund_money"
                        :disabled="is_abnormal==1?true:false"
                      >
                      </el-input>
                    </el-form-item>
                        <el-form-item
                      label="追回佣金"
                      v-if="dealer_settled!=null||is_ticket==1"
                    >
                      <el-radio-group
                        v-model="formFormatData.formData.recover"
                        style="margin-left:20px;"
                      >
                        <el-radio label="1">是</el-radio>
                        <el-radio label="2">否</el-radio>
                      </el-radio-group>
                      <!-- <div class="form-help">注：立即到账才能追回佣金</div> -->
                    </el-form-item>
                      <el-form-item
                      label="佣金追回比列"
                      v-if="is_ticket==1"
                    >
                    <el-input v-model="formFormatData.formData.proportion" style="width:100px;"> </el-input>
                    <div class="form-help">注：列如"2/3",请务必按照格式填写！</div>
                    </el-form-item>
                      <el-form-item
                      label="退款原因"
                    >
                      <el-input
                        type="textarea"
                        :rows="2"
                        v-model.trim="formFormatData.formData.refund_content"
                      >
                      </el-input>
                    </el-form-item>
                     <el-table
                      :data="verificationData"
                      style="width: 100%"
                       v-if="dealer_settled!=null && express_type_data==3"
                    >
                      <!-- <el-table-column
                        :selectable='selectable'
                        type="selection"
                        width="55"
                      >
                      </el-table-column> -->
                      <el-table-column label="核销码">
                        <template slot-scope="scope">
                          <span v-if="scope.row.check_status==0">{{scope.row.code}}</span>
                        </template>
                      </el-table-column>
                       <el-table-column label="状态">
                        <template slot-scope="scope">
                          <span
                            v-if="scope.row.check_status==1"
                            class="orders-gray"
                          >已核销</span>
                          <span
                            v-if="scope.row.check_status==0"
                            class="orders-green"
                          >未核销</span>
                        </template>
                      </el-table-column>
                          <el-table-column label="预计追回佣金">
                        <template slot-scope="scope">
                          <span v-if="scope.row.check_status==0">{{scope.row.dealer_money}}</span>
                        </template>
                      </el-table-column>
                     </el-table>
                  </template>
                </el-form>
              </div>
            </div>
          </div>
        </el-scrollbar>
      </div>
      <footer class="flex-row flex-align-c flex-justify-c wlm-dialog-fixfooter">
        <el-button
          size="small"
          type="primary"
          @click="clickbtn"
        >确定</el-button>
      </footer>
    </el-dialog>

    <div
      class="wlm-form"
      style="border-radius:0;"
    >
      <div class="wlm-form-steps flex-row flex-align-c flex-justify-c">
        <el-steps
          align-center
          :active="orderStep"
        >
          <el-step
            title="用户下单"
            v-if="$detail"
            :description="$detail.create_time"
          ></el-step>
          <!-- {{$detail.pay_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}} -->
          <el-step
            title="用户付款"
            v-if="$detail"
            :description="payTimeStep"
          ></el-step>
          <el-step
            v-if="!isCardpassword"
            :title="`${isVerification?'用户核销':isComeStore?'用户自提':isExpressDelivery?'商家发货':isGroup?'用户提货':''}`"
            :description="orderStep >= 3?isExpressDelivery? `${$detail.delivery_time !== 0 ? `${$detail.delivery_time}`: ''}`:isVerification?`${$detail.verclerk_time}`:`${$detail.update_time !== 0 ? `${$detail.update_time}` : ''}`:''"
          ></el-step>
          <el-step
            :title="`${$isColsed ? '已关闭':'已完成'}`"
            :description="orderStep >= 4?`${$detail.update_time !== 0 ? `${$detail.update_time}` : ''}`:''"
            v-if="!isExpressDelivery"
          ></el-step>
          <el-step
            :title="`${$isColsed ? '已关闭':'用户收货'}`"
            :description="orderStep >= 4?`${$detail.receipt_time !== 0 ? `${$detail.receipt_time}` : ''}` : ''"
            v-if="isExpressDelivery"
          ></el-step>
        </el-steps>
      </div>
    </div>

    <section class="flex-row flex-warp form-group">
      <div class="wlm-form">
        <div class="wlm-form-header flex-row flex-justify-b">
          <p>订单信息</p>
          <router-link
            v-if="isVerification"
            class="wlm-text"
            tag="span"
            :to="{path:'/orders/ordersManagementVerification', query:{order_id:$detail.order_id}}"
          >
            <!-- {{$route.query.is_ticket}} -->
            <el-button
              v-if="!$route.query.is_ticket"
              type="text"
            >核销记录</el-button>
          </router-link>
        </div>
        <div class="wlm-form-content">
          <el-form
            :ref="formFormatData.key"
            :model="formFormatData.formData"
            :rules="formFormatData.rules"
            size="small"
            label-width="120px"
            class="retail-form"
            label-position="right"
          >
            <el-form-item label="订单编号：">
              <span>{{$detail.order_no}}</span>
            </el-form-item>
                 <el-form-item label="交易单号：" v-if="$detail.paytype_text.text=='微信'">
              <span>{{$detail.transaction_id}}</span>
            </el-form-item>
            <el-form-item label="订单类型：">
              <span>{{orderType[`${$detail.order_type}`]}}</span>
            </el-form-item>
            <el-form-item label="订单来源：">
              <span>{{sourceType[`${$detail.source}`]}}</span>
            </el-form-item>
            <el-form-item label="支付方式：">
              <span v-if="$detail.paytype_text && orderStep >= 2">{{$detail.paytype_text.text}}</span>
              <span v-else>-</span>
            </el-form-item>
            <el-form-item label="订单状态：">
              <!-- <span class="text-danger text-weight-6" v-if="$detail.express_type">{{$detail.order_status==30?'已完成':$detail.order_status==10?'已付款':'待付款'}}</span> -->
              <span
                class="text-danger text-weight-6"
                v-if="$detail.express_type"
              >{{$detail.order_status==30?'已完成':$detail.pay_status.text}}</span>
              <span
                class="text-danger text-weight-6"
                v-else
              >{{$detail.state_text}}</span>
              <!-- <span v-if="$detail.is_abnormal==1">异常订单</span> -->
              <el-tag type="warning" v-if="$detail.is_abnormal==1">异常订单</el-tag>
            </el-form-item>
            <el-form-item
              label="自提店铺："
              v-if="isComeStore && $detail.store_name"
            >
              <span>{{$detail.store_name}}</span>
            </el-form-item>
            <!-- <el-form-item label="二维码：" v-if="isComeStore">
                        <img src="" alt="" height="50" width="50">
                    </el-form-item>
                    this.$route.query. 
                    v-if="$route.query.is_ticket"-->
            <el-form-item
              label="票务平台："
               v-if="$route.query.is_ticket"
            >
            <!-- {{$detail && $detail.ticket && $detail.ticket.ticket_type || ''}} -->
              <span v-if="$detail && $detail.ticket && $detail.ticket.ticket_type==1 || ''">自我游</span>
              <span v-if="$detail && $detail.ticket && $detail.ticket.ticket_type==2 || ''">天时同城</span>
            </el-form-item>
             <el-form-item
              label="票务平台商品ID："
               v-if="$route.query.is_ticket"
            >
             <span>{{$detail && $detail.ticket && $detail.ticket.info_id || ''}}</span>
            </el-form-item>
             <el-form-item
              label="姓名："
               v-if="$route.query.is_ticket"
            >
             <span>{{$detail && $detail.ticket && $detail.ticket.link_man || ''}}</span>
            </el-form-item>
             <el-form-item
              label="手机号："
               v-if="$route.query.is_ticket"
            >
             <span>{{$detail && $detail.ticket && $detail.ticket.link_phone || ''}}</span>
            </el-form-item>
            <el-form-item
              label="游玩日期:"
               v-if="$route.query.is_ticket"
            >
             <span>{{$detail && $detail.ticket && $detail.ticket.travel_date || ''}}</span>
            </el-form-item>
             <el-form-item
              label="票务平台订单ID:"
               v-if="$route.query.is_ticket"
            >
             <span>{{$detail && $detail.ticket && $detail.ticket.ticket_order_id || ''}}</span>
            </el-form-item>
          </el-form>
        </div>
      </div>

      <div class="wlm-form">
        <div class="wlm-form-header">用户信息</div>
        <div class="wlm-form-content">
          <el-form
            :ref="formFormatData.key"
            :model="formFormatData.formData"
            :rules="formFormatData.rules"
            size="small"
            label-width="120px"
            class="retail-form"
            label-position="right"
          >
            <el-form-item label="用户：">
              <p>{{$detail.user_info.nickName}}</p>
              <!-- <p>{{$route.query.nickName}}</p> -->
            </el-form-item>
            <el-form-item label="用户id：">
              <!-- <p>{{$route.query.user_id}}</p> -->
              <p>{{$detail.user_info.user_id}}</p>
            </el-form-item>
            <el-form-item
              label="发货信息："
              class="kami-data"
              v-if="isCardpassword&&$detail.pay_status.value==20"
            >
              <el-scrollbar style="width:100%;height: 150px;max-height: 150px;">
                <div
                  v-for="(item, index) in $detail.key.data"
                  :key="index"
                  class="kami-box"
                >
                  <p
                    class="kami-box-item"
                    style="font-weight:600"
                  >卡密{{index+1}}：</p>
                  <div
                    v-for="(citem, cindex) in item"
                    :key="cindex"
                  >
                    <p class="kami-box-item">{{citem.key}}：{{citem.value}}</p>
                  </div>
                  <div
                    v-if="$detail.key.data.length!=(index+1)"
                    class="kami-line"
                  ></div>
                </div>
              </el-scrollbar>
            </el-form-item>
            <el-form-item
              label="收货人："
              v-if="$detail.address"
            >
              <p>{{$detail.address.name}}</p>
            </el-form-item>
            <el-form-item
              label="联系方式："
              v-if="$detail.address"
            >
              <span>{{$detail.address.phone}}</span>
            </el-form-item>
            <el-form-item
              :label="$detail.express_type ==5?'团长地址：':'收货地址：'"
              v-if="$detail.address"
            >
              <span v-if="$detail.express_type ==5">{{$detail.reg_order.reg_address}}({{$detail.reg_order.reg_name}}:{{$detail.reg_order.reg.phone}})</span>
              <span v-else>{{`${$detail.address.region.province?$detail.address.region.province:'无'}${$detail.address.region.city?$detail.address.region.city:'无'}${$detail.address.region.region?$detail.address.region.region:'无'}${$detail.address.detail==0 ||!$detail.address.detail ?'无':$detail.address.detail }`}}</span>
            </el-form-item>
            <!-- formSubmitDetail -->
            <el-form-item label="买家备注：">
              <span>{{$detail.buyer_remark || '-'}}</span>
            </el-form-item>
            <!-- <el-form-item label="单行文本：">
                        <span>{{default}}</span>
                    </el-form-item> -->
            <!-- 自定义表单数据 -->
            <div
              v-for="(item,index) in formSubmit.pc_value"
              :key="index"
            >
              <el-form-item :label="keyValueTitle[item.key] ? keyValueTitle[item.key] :item.name">
                <!-- 单行文本、多行文本、身份证、时间、日期 -->
                <div v-if="['singletext','manytext','cardnumber','datetext','datatime'].indexOf(item.key) != -1">
                  {{item.default}}
                </div>
                <!-- 单选、多选、下拉框 -->
                <div v-if="['downbox','checkbox','radio'].indexOf(item.key) != -1">
                  <div
                    v-for="(v,i) in item.meal"
                    :key="i"
                  >
                    {{ v.balanceone }}
                  </div>
                </div>
                <!-- 图片 -->
                <div v-if="['image'].indexOf(item.key) != -1">
                  <div style="display:flex;">
                    <div
                      v-for="(v,i) in item.default"
                      :key="i"
                    >
                      <!-- {{ v }} -->
                      <img
                        style="width:50px;height:50px;margin-right:10px;"
                        :src="v?v:''"
                      >
                    </div>
                  </div>
                </div>
                <!-- 日期范围、时间范围 -->
                <div v-if="['datatextrange','timeframe'].indexOf(item.key) != -1">
                  {{item.name.startname}}:{{item.default.startappointdata}} — {{item.name.endname}}:{{item.default.endappointdata}}

                </div>
                <!-- 城市 -->
                <div v-if="['city'].indexOf(item.key) != -1">
                  {{item.address.province + '-' + item.address.city + '-' + item.address.region}}
                </div>
              </el-form-item>
            </div>
            <!-- 自定义表单数据 END -->
          </el-form>

        </div>
      </div>

      <div class="wlm-form">
        <div class="wlm-form-header">订单收益</div>
        <div class="wlm-form-content">

          <div class="flex-row  total-money">
            <ul>
              <li><span
                  class="total-title"
                  v-if="$detail"
                >总计：</span><span class="orders-red"><span>￥</span>{{$detail.total_price}}</span></li>
              <li><span
                  class="total-title"
                  v-if="$detail"
                >优惠：</span><span class="orders-red"><span>￥</span>{{$detail.coupon_price}}</span></li>
              <li v-if="$detail.member_card_price"><span class="total-title">会员卡费用：</span><span class="orders-red"><span>￥</span>{{$detail.member_card_price}}</span></li>
              <li v-if="$detail.member_coupon_price"><span class="total-title">会员优惠：</span><span class="orders-red"><span>￥</span>{{$detail.member_coupon_price}}</span></li>
              <li v-if="$detail.groups_price"><span class="total-title">团长优惠：</span><span class="orders-red"><span>￥</span>{{$detail.groups_price}}</span></li>
              <li v-if="$detail.integral_rebate_money"><span class="total-title">{{formFormatData.formData.str}}抵扣价：</span><span class="orders-red"><span>￥</span>{{$detail.integral_rebate_money}}</span></li>
              <li v-if="$detail.return_money"><span class="total-title">返现金额：</span><span class="orders-red"><span>￥</span>{{$detail.return_money}}</span></li>
              <li v-if="$detail&&isExpressDelivery"><span class="total-title">运费：</span><span class="orders-red"><span>￥</span>{{$detail.express_price}}</span></li>
              <li v-if="$detail.update_price&&$detail.update_price.value!='0.00'"><span
                  class="total-title"
                  style="margin-right:-1px"
                >后台改价：</span><span class="orders-red"><span>{{$detail.update_price.symbol}} ￥</span>{{$detail.update_price.value}}</span></li>
              <li v-if="$detail.refund_commission"><span class="total-title">退款手续费：</span><span class="orders-red"><span>￥</span>{{$detail.refund_commission}}</span></li>
              <li v-if="$detail.total_pay_price"><span class="total-title">商品金额：</span><span class="orders-red"><span>￥</span>{{$detail.total_pay_price}}</span></li>
              <li v-if="$detail.dealer_money"><span class="total-title">分销扣掉金额：</span><span class="orders-red"><span>￥</span>{{$detail.dealer_money}}</span></li>
              <li v-if="$detail.settlement_money"><span class="total-title">商家所得金额：</span><span class="orders-red"><span>￥</span>{{$detail.settlement_money}}</span></li>
              <li v-if="$detail.platform_money"><span class="total-title">平台所得利润：</span><span class="orders-red"><span>￥</span>{{$detail.platform_money}}</span></li>
              <li v-if="$detail&&$detail.pay_status && $detail.pay_status.value!=10"><span class="total-title">实付金额：</span><span
                  v-if="$detail.total_money==0"
                  class="orders-red"
                >￥{{$detail.pay_price}}</span><span
                  v-if="$detail.total_money!=0"
                  class="orders-red"
                >￥{{$detail.total_money}}</span></li>
            </ul>
          </div>
        </div>
      </div>
    </section>

    <div
      class="wlm-form"
      v-if="isVerification && !$route.query.is_ticket"
    >
      <div class="wlm-form-header"><span>核销码信息</span>
        <span class="vercode-time">
          <span>有效期：</span>
          <span v-if="Array.isArray($detail.vercode)&&$detail.vercode.length>0&&$detail.vercode[0]['end_time']!=-1">{{$detail.vercode[0]['start_time'] | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}} - {{$detail.vercode[0]['end_time'] | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
          <span v-if="Array.isArray($detail.vercode)&&$detail.vercode.length>0&&$detail.vercode[0]['end_time']==-1">{{$detail.vercode[0]['start_time'] | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}} 起 长期有效</span>
          <span v-if="!Array.isArray($detail.vercode)">-</span>
        </span>
      </div>
      <div class="wlm-form-content">
        <div class="wlm-table">
          <div class="wlm-table-content">
            <el-table
              v-if="isVerification"
              :ref="tableFormatData.announcement.key"
              :data="($detail && Array.isArray($detail.vercode)&&$detail.vercode.length>0 ?$detail.vercode:[])"
              @selection-change="handleSelectionChange"
              style="width: 100%"
            >
              <el-table-column
                prop="date"
                label="核销码"
              >
                <template slot-scope="scope">
                  <div style="display: flex;align-items:center;">
                    <div class="list-info">{{scope.row.code}}</div>
                    <div v-if="scope.row.is_give==1">(赠送)</div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="状态"
              >
                <template slot-scope="scope">
                  <div v-if="scope.row.is_refund==0&&(scope.row.end_time=='-1'||(scope.row.end_time!='-1'||Date.now()<scope.row.end_time*1000))">
                    <p v-if="scope.row.check_status==0">待核销</p>
                    <p v-if="scope.row.check_status==1">已核销</p>
                    <p v-if="scope.row.check_status==2">已退款</p>
                  </div>
                  <div v-if="scope.row.is_refund!=0&&(scope.row.end_time=='-1'||(scope.row.end_time!='-1'||Date.now()<scope.row.end_time*1000))">
                    <p v-if="scope.row.is_refund==30&&scope.row.check_status!=2">退款中</p>
                    <p v-if="scope.row.is_refund==30&&scope.row.check_status==2">已退款</p>
                  </div>
                  <p v-if="scope.row.end_time!='-1'&&scope.row.is_refund==0&&scope.row.check_status==0">
                    <span v-if="Date.now()>scope.row.end_time*1000">已过期</span>
                  </p>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="核销门店"
              >
                <template slot-scope="scope">
                  <div class="flex-col">
                    <p
                      v-if="scope.row.busstore"
                      class="list-info"
                    >{{scope.row.busstore.name}}</p>
                    <p
                      v-if="scope.row.check_clerk_id == -1 && scope.row.check_status==1"
                      class="list-info"
                    >后台核销</p>
                    <p
                      v-else-if="!scope.row.busstore"
                      class="list-info"
                    >-</p>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="核销人员"
              >
                <template slot-scope="scope">
                  <div class="flex-col">
                    <p
                      v-if="scope.row.record&&scope.row.record.user"
                      class="list-info"
                    >{{scope.row.record.user.name}}</p>
                    <p
                      v-else
                      class="list-info"
                    >-</p>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="操作时间"
              >
                <template slot-scope="scope">
                  <p v-if="scope.row.check_time!=0">{{scope.row.check_time * 1000 | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</p>
                  <p v-if="scope.row.check_time==0">-</p>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
    </div>

    <div class="wlm-form">
      <div class="wlm-form-header">商品信息</div>
      <div class="wlm-form-content">
        <div class="wlm-table">
          <div class="wlm-table-content">
            <!-- 核销 -->
            <el-table
              v-if="isVerification"
              :ref="tableFormatData.announcement.key"
              :data="($detail.goods?$detail.goods:[])"
              @selection-change="handleSelectionChange"
              style="width: 100%"
            >
              <el-table-column
                prop="date"
                label="商品"
              >
                <template slot-scope="scope">
                  <div class="flex-row">
                    <img
                      width="50"
                      v-if="scope.row.goods.image"
                      height="50"
                      :src="scope.row.goods.image[0]['file_path']"
                      style="margin-right:10px;"
                    >
                    <div class="text-left">
                      <p>{{scope.row.goods_name || '-'}}</p>
                      <p class="orders-red">{{`￥${scope.row.goods_price}` || '-'}}</p>
                    </div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="数量"
              >
                <template slot-scope="scope">
                  <span>{{scope.row.total_num}}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="购买规格"
              >
                <template slot-scope="scope">
                  <span v-if="scope.row.sku">{{scope.row.sku.title||'-'}}</span>
                  <span v-if="!scope.row.sku">{{$detail.goods[0].goods_attr||'-'}}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="小计"
              >
                <template slot-scope="scope">
                  <p class="orders-red">{{`￥${scope.row.total_pay_price}` || '-'}}</p>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="优惠价"
              >
                <template slot-scope="scope">
                  <span class="orders-red">￥{{$detail.coupon_price}}</span>
                </template>
              </el-table-column>
            </el-table>
            <!-- 自提 -->
            <el-table
              v-if="isComeStore"
              :ref="tableFormatData.announcement.key"
              :data="($detail?$detail.goods:[])"
              @selection-change="handleSelectionChange"
              style="width: 100%"
            >
              <el-table-column
                prop="date"
                label="商品"
              >
                <!-- <template slot-scope="scope">
                                <span>夏季西裤</span>
                            </template> -->
                <template slot-scope="scope">
                  <div class="flex-row">
                    <img
                      width="50"
                      v-if="scope.row.image"
                      height="50"
                      :src="scope.row.image.file_path"
                      style="margin-right:10px;"
                    >
                    <div class="text-left">
                      <p>{{scope.row.goods_name || '-'}}</p>
                      <p class="orders-red">{{`￥${scope.row.goods_price}` || '-'}}</p>
                    </div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="数量"
              >
                <template slot-scope="scope">
                  <span>{{scope.row.total_num}}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="购买规格"
              >
                <template slot-scope="scope">
                  <span v-if="scope.row.sku">{{scope.row.sku.title||'-'}}</span>
                  <span v-if="!scope.row.sku">{{$detail.goods[0].goods_attr||'-'}}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="小计"
              >
                <template slot-scope="scope">
                  <p class="orders-red">{{`￥${scope.row.total_pay_price}` || '-'}}</p>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="优惠价"
              >
                <template slot-scope="scope">
                  <span class="orders-red">￥{{$detail.coupon_price}}</span>
                </template>
              </el-table-column>
            </el-table>
            <!-- 快递 -->
            <el-table
              v-if="isExpressDelivery"
              :ref="tableFormatData.announcement.key"
              :data="($detail?$detail.goods:[])"
              @selection-change="handleSelectionChange"
              style="width: 100%"
            >
              <el-table-column
                prop="date"
                label="商品"
              >
                <template slot-scope="scope">
                  <div class="flex-row">
                    <img
                      width="50"
                      v-if="scope.row.image"
                      height="50"
                      :src="scope.row.image.file_path"
                      style="margin-right:10px;"
                    >
                    <div class="text-left">
                      <p>{{scope.row.goods_name || '-'}}</p>
                      <p class="orders-red">{{`￥${scope.row.goods_price}` || '-'}}</p>
                    </div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="数量"
              >
                <template slot-scope="scope">
                  <span>{{scope.row.total_num}}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="购买规格"
              >
                <template slot-scope="scope">
                  <span v-if="scope.row.sku">{{scope.row.sku.title||'-'}}</span>
                  <span v-if="!scope.row.sku">{{$detail.goods[0].goods_attr||'-'}}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="小计"
              >
                <template slot-scope="scope">
                  <p class="orders-red">{{`￥${scope.row.total_pay_price}` || '-'}}</p>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="优惠价"
              >
                <template slot-scope="scope">
                  <span class="orders-red">￥{{$detail.coupon_price}}</span>
                </template>
              </el-table-column>
            </el-table>
            <!-- 卡密 -->
            <el-table
              v-if="isCardpassword"
              :ref="tableFormatData.announcement.key"
              :data="($detail?$detail.goods:[])"
              @selection-change="handleSelectionChange"
              style="width: 100%"
            >
              <el-table-column
                prop="date"
                label="商品"
              >
                <template slot-scope="scope">
                  <div class="flex-row">
                    <img
                      width="50"
                      v-if="scope.row.image"
                      height="50"
                      :src="scope.row.image.file_path"
                      style="margin-right:10px;"
                    >
                    <div class="text-left">
                      <p>{{scope.row.goods_name || '-'}}</p>
                      <p class="orders-red">{{`￥${scope.row.goods_price}` || '-'}}</p>
                    </div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="数量"
              >
                <template slot-scope="scope">
                  <span>{{scope.row.total_num}}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="小计"
              >
                <template slot-scope="scope">
                  <p class="orders-red">{{`￥${scope.row.total_pay_price}` || '-'}}</p>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="优惠价"
              >
                <template slot-scope="scope">
                  <span class="orders-red">￥{{$detail.coupon_price}}</span>
                </template>
              </el-table-column>
            </el-table>
            <!-- 团购 -->
            <el-table
              v-if="isGroup"
              :ref="tableFormatData.announcement.key"
              :data="($detail?$detail.goods:[])"
              @selection-change="handleSelectionChange"
              style="width: 100%"
            >
              <el-table-column
                prop="date"
                label="商品"
              >
                <template slot-scope="scope">
                  <div class="flex-row">
                    <img
                      width="50"
                      v-if="scope.row.image"
                      height="50"
                      :src="scope.row.image.file_path"
                      style="margin-right:10px;"
                    >
                    <div class="text-left">
                      <p>{{scope.row.goods_name || '-'}}</p>
                      <p class="orders-red">{{`￥${scope.row.goods_price}` || '-'}}</p>
                    </div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="数量"
              >
                <template slot-scope="scope">
                  <span>{{scope.row.total_num}}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="小计"
              >
                <template slot-scope="scope">
                  <p class="orders-red">{{`￥${scope.row.total_pay_price}` || '-'}}</p>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="优惠价"
              >
                <template slot-scope="scope">
                  <span class="orders-red">￥{{$detail.coupon_price}}</span>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
    </div>
    <div class="wlm-form">
      <div class="wlm-form-header">订单日志</div>
      <div
        class="logitem"
        v-for="(item, index) in this.formFormatData.formData.log"
        :key="index"
      >
        <div class="title"><i class="el-icon-info icon"></i><span>{{item[0]}}</span></div>
        <div class="content"><span>{{item[1]}}</span></div>
      </div>
    </div>
    <!-- <div class="flex-row flex-row-reverse total-money">
        <ul>
            <li><span class="total-title" v-if="$detail">总计：</span><span class="orders-red"><span>￥</span>{{$detail.total_price}}</span></li>
            <li><span class="total-title" v-if="$detail">优惠：</span><span class="orders-red"><span>￥</span>{{$detail.coupon_price}}</span></li>
            <li v-if="$detail.member_card_price"><span class="total-title">会员卡费用：</span><span class="orders-red"><span>￥</span>{{$detail.member_card_price}}</span></li>
            <li v-if="$detail.member_coupon_price"><span class="total-title">会员优惠：</span><span class="orders-red"><span>￥</span>{{$detail.member_coupon_price}}</span></li>
            <li v-if="$detail.groups_price"><span class="total-title">团长优惠：</span><span class="orders-red"><span>￥</span>{{$detail.groups_price}}</span></li>
            <li v-if="$detail.integral_rebate_money"><span class="total-title">{{formFormatData.formData.str}}抵扣价：</span><span class="orders-red"><span>￥</span>{{$detail.integral_rebate_money}}</span></li>
            <li v-if="$detail.return_money"><span class="total-title">返现金额：</span><span class="orders-red"><span>￥</span>{{$detail.return_money}}</span></li>
            <li v-if="$detail&&isExpressDelivery"><span class="total-title">运费：</span><span class="orders-red"><span>￥</span>{{$detail.express_price}}</span></li>
            <li v-if="$detail.update_price&&$detail.update_price.value!='0.00'"><span class="total-title" style="margin-right:-1px">后台改价：</span><span class="orders-red"><span>{{$detail.update_price.symbol}} ￥</span>{{$detail.update_price.value}}</span></li>
            <li v-if="$detail.refund_commission"><span class="total-title">退款手续费：</span><span class="orders-red"><span>￥</span>{{$detail.refund_commission}}</span></li>
            <li v-if="$detail.total_pay_price"><span class="total-title">商品金额：</span><span class="orders-red"><span>￥</span>{{$detail.total_pay_price}}</span></li>
            <li v-if="$detail.dealer_money"><span class="total-title">分销扣掉金额：</span><span class="orders-red"><span>￥</span>{{$detail.dealer_money}}</span></li>
            <li v-if="$detail.settlement_money"><span class="total-title">商家所得金额：</span><span class="orders-red"><span>￥</span>{{$detail.settlement_money}}</span></li>
            <li v-if="$detail.platform_money"><span class="total-title">平台所得利润：</span><span class="orders-red"><span>￥</span>{{$detail.platform_money}}</span></li>
            <li v-if="$detail&&$detail.pay_status && $detail.pay_status.value!=10"><span class="total-title">实付金额：</span><span v-if="$detail.total_money==0" class="orders-red">￥{{$detail.pay_price}}</span><span v-if="$detail.total_money!=0" class="orders-red">￥{{$detail.total_money}}</span></li>
        </ul>
    </div> -->

    <div
      v-cloak
      class="wlm-fixed-btn flex-row flex-align-c flex-justify-c"
    >
      <div
        style="position: relative;white-space: nowrap;"
        v-for="(buttonItem, buttonIndex) in $detail.show_button"
        :key="buttonIndex"
        v-if="$route.query.is_ticket!=1"
      >
        <!-- 付款 -->
        <el-button
          v-if="buttonItem.value == 1 && buttonItem.event == 'pay'"
          type="primary"
          @click="changeTableItem({order_id:$goods.order_id},tableFormatData.announcement.change.payorder,{isWarning: true,warning:'商家是否与用户完成了线下付款，否则带来损失商家自付？',cancel:'已取消'})"
        >{{buttonItem.text}}</el-button>
        <!-- 核销 自提 发货 -->
        <el-button
          v-if="buttonItem.value == 1 && buttonItem.event == 'send' && buttonItem.type == 1"
          type="primary"
          @click="showDialog({formType:'1',params:{id:$goods.order_id,toggle:'dialogTableVisible',noEdit:true}})"
        >{{buttonItem.text}}</el-button>
        <el-button
          v-if="buttonItem.value == 1 && buttonItem.event == 'send' && buttonItem.type == 2"
          type="primary"
          @click="changeTableItem({order_id:$goods.order_id},tableFormatData.announcement.change.selfDelery,{isWarning: true,warning:'是否确认自提？',cancel:'已取消'})"
        >{{buttonItem.text}}</el-button>
        <el-button
          v-if="buttonItem.value == 1 && buttonItem.event == 'send' && buttonItem.type == 3"
          type="primary"
          @click="showDialog({formType:'3',params:{id:$goods.order_id,toggle:'dialogTableVisible',noEdit:true,bus_id:$goods.bus_id}})"
        >{{buttonItem.text}}</el-button>
        <!-- 退款 -->
        <!-- <el-button
          v-if="buttonItem.value == 1 && buttonItem.event == 'refund'"
          type="primary"
          @click="changeTableItem({id:$goods.order_id},tableFormatData.announcement.change.refund,{isWarning: true,warning:'确定是否帮助用户退款？',cancel:'已取消'})"
        >{{buttonItem.text}}</el-button> -->
         <el-button
          v-if="buttonItem.value == 1 && buttonItem.event == 'refund'"
          type="primary"
             @click="showDialog({formType:'5',params:{id:$detail.order_id,toggle:'dialogTableVisible',noEdit:true},dealer_settled:$detail.dealer_settled,express_type:$detail.express_type})"
        >{{buttonItem.text}}</el-button>
        <!-- 延期 -->
        <el-button
          v-if="buttonItem.value == 1 && buttonItem.event == 'delay'"
          type="primary"
          @click="showDialog({formType:'3-1',params:{id:$goods.order_id, toggle:'dialogTableVisible',noEdit:true}})"
        >延期</el-button>
        <!-- 关闭 -->
        <el-button
          v-if="isComeStore && buttonItem.value == 1 && buttonItem.event == 'close'"
          type="primary"
          class="right-8"
          @click="changeTableItem({order_id:$detail.order_id},tableFormatData.announcement.change.close,{isWarning: true,warning:'确定是否关闭订单？',cancel:'已取消', router: { type: 'replace', path: '/orders/ordersComeStoreManagement', code: 1 }})"
        >关闭订单</el-button>
        <el-button
          v-if="isExpressDelivery && buttonItem.value == 1 && buttonItem.event == 'close'"
          type="primary"
          class="right-8"
          @click="changeTableItem({order_id:$detail.order_id},tableFormatData.announcement.change.close,{isWarning: true,warning:'确定是否关闭订单？',cancel:'已取消', router: { type: 'replace', path: '/orders/ordersExpressManagement', code: 1 }})"
        >关闭订单</el-button>
        <el-button
          v-if="isVerification && buttonItem.value == 1 && buttonItem.event == 'close'"
          type="primary"
          class="right-8"
          @click="changeTableItem({order_id:$detail.order_id},tableFormatData.announcement.change.close,{isWarning: true,warning:'确定是否关闭订单？',cancel:'已取消', router: { type: 'replace', path: '/orders/ordersVerificationManagement', code: 1 }})"
        >关闭订单</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { parseTime } from '@/utils'
import dayjs from 'dayjs'
// import upload from '@/components/Upload/index'
// import ueditor from '@/components/Ueditor/index'
import {
  orderCodeList,
  orderCheckCode,
  orderCheckCodeRecord,
  orderSelfDelery,
  orderSend,
  getExpress,
  orderDelay,
  orderDetail,
  orderConfirmPay,
  orderRefund,
  orderClose,
  getBusForGiftOrder,
  formSubmitDetail
} from '@/api/orders'
import {
  shopIndex
} from '@/api/merchant'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Form'), mixins.getters('Table')],
  name: 'OrdersManagementDetail',
  components: {

  },
  directives: {

  },
  computed: {
    $detail() {
      return this.formFormatData.formData.detail || {}
    },
    $isColsed() {
      return this.$detail && this.$detail.is_closed && this.$detail.is_closed.value === '1'
    },
    $goods() {
      const { goods: [$goods] } = this.$detail
      return $goods
    },
    // verificationTime() {
    //   if(this.$detail.vercode){
    //     var temp = new Date(this.$detail.vercode[0]['update_time']).getTime()
    //     console.log(this.$detail.vercode, 'this.$detail.vercode')
    //     this.$detail.vercode.map(item => {
    //         console.log(new Date(item.update_time).getTime(), temp, 'temp222')
    //         if (new Date(item.update_time).getTime() > temp) {
    //         console.log(new Date(item.update_time).getTime(), 'temp223')
    //         temp = new Date(item.update_time).getTime()
    //         }
    //     })
    //     return parseTime(temp, '{y}-{m}-{d} {h}:{i}:{s}')
    //   } else {
    //     return this.$detail.vercode[0]['update_time']
    //   }
    // },
    payTimeStep() {
      return this.orderStep >= 2 ? (parseTime(this.$detail.pay_time, '{y}-{m}-{d} {h}:{i}:{s}')) : ''
    },
    hasVarCode() {
      return Array.isArray(this.$detail.vercode) && this.$detail.vercode.length > 0
    },
    orderStep() {
      let step = 0
      const detail = this.$detail
      if (detail.order_status) {
        if (detail.order_status !== 20) {
          if (detail.pay_status.value === 10) {
            step = 1
          } else if (detail.pay_status.value === 20 && detail.delivery_status.value === 10) {
            step = 2
          } else if (detail.delivery_status.value === 20 && detail.receipt_status.value === 10) {
            step = 3
          } else if (detail.receipt_status.value === 20) {
            step = 4
          }
        } else {
          step = 1
        }
      }
      return step
    },
    isAfterSale() {
      return this.$store.getters.beforepath === '/orders/afterSale'
    },
    isOrdersManagement() {
      // 从核销或者自提或者快递三个页面的其中一个跳转过来的
      return this.$store.getters.beforepath === 'ordersVerificationManagement' || this.$store.getters.beforepath === 'ordersComeStoreManagement' || this.$store.getters.beforepath === 'ordersExpressManagement' || this.$store.getters.beforepath === 'ordersCardPasswordManagement'
    },
    // 核销
    isVerification() {
      // 从核销或者自提或者快递三个页面的其中一个跳转过来的 并且订单状态等于3
      return this.$detail.express_type === 3
    },
    // 卡密kami
    isCardpassword() {
      return this.$detail.express_type === 4
      
    },
    // 自提
    isComeStore() {
      // 从核销或者自提或者快递三个页面的其中一个跳转过来的 并且订单状态等于2
      return this.$detail.express_type === 2
    },
    // 快递
    isExpressDelivery() {
      // 从核销或者自提或者快递三个页面的其中一个跳转过来的 并且订单状态等于1
      return this.$detail.express_type === 1
    },
    // 团购
    isGroup() {
      // 从核销或者自提或者快递三个页面的其中一个跳转过来的 并且订单状态等于1
      return this.$detail.express_type === 5
    },
   
    // isBulkShipment() {
    //   return this.$detail.express_type === 1
    // },
    // isAfterSaleRefund() {
    //   return this.isAfterSale && this.formFormatData.formData.afterStatus === 1
    // },
    // isAfterSaleExchange() {
    //   return this.isAfterSale && this.formFormatData.formData.afterStatus === 2
    // }
  },
  created() {
    this.$nextTick(() => {
      console.log("神鼎飞丹砂个梵蒂冈放多久",this.$store.getters.beforepath)
      getExpress().then((response) => {
        const { data: { data: msgData = [] } } = response
        this.expressList = msgData
      })
      if (!this.$route.query.is_ticket) {
        orderCheckCodeRecord({ order_id: this.$route.query.order_id }).then(response => {
          const { data: { data: listData = [] } } = response
          this.hasVercodeTableData = Array.isArray(listData) && listData.length > 0
        })
      }
      this.formSubmitDetailbtn()
    })
  },
  data() {
    return {
      // 'datatextrange','timeframe'
      keyValueTitle: {
        datatextrange: '日期范围',
        timeframe: '时间范围',
      },
      express_type_data:'',
       dealer_settled:'',
      hasVercodeTableData: false,
      formSubmit: {},
      defaults: '',
      names: '',
      hdefaults: '',
      hnames: '',
      end_time: '',
      sourceType: {
        '1': '导入',
        '2': '微信小程序',
        '3': 'H5',
        '4': '公众号',
        '5': '安卓',
        '6': '苹果',
        '7': '支付宝小程序',
        '8': '百度小程序',
        '9': '头条小程序',
        '-': '-'
      },
      orderType: {
        '0': '普通订单',
        '1': '普通订单',
        '2': '拼团订单',
        '3': '秒杀订单',
        '4': '卡密订单'
      },
      checkType: {
        '0': '待核销',
        '1': '已核销',
        '2': '已退款'
      },
      storeidData: [],
      verificationSerch: '',
      verificationData: [],
      expressList: [],
      dialogTableVisible: false,

      formFormatData: {
        key: 'smsSettings',
        model: {
          bindDialog: 'dialogTableVisible'
        },
        api: {
          editForm: {
            api: orderDetail,
            params: {
              always: true
            }
          }
        },
        formData: {
          store_id: '',
          detail: {},
          str: '',
          log: [],
          status: '0',
          bus_id: '',
          time: [0, 0, 0],
          vercode_id: [],
          express_company: '',
          express_no: '',
          reason: '',
          giftorder: [],
          refund_type: '1',
          refund_root: '3',
          refund_content:'',
          refund_money: '',
          recover:'1',
          proportion:'',

        },
        rules: {

        }
      },
      tableFormatData: {
        current: 'announcement',
        announcement: {
          key: 'announcement',
          tableData: [],
          files: {
            status: '1',
            title: '',
            ids: [],
            checkall: '0',
            Recycle: '0'
          },
          change: {
            refund: {
              name: '退款',
              key: 'refund',
              api: orderRefund
            },
            payorder: {
              name: '付款',
              key: 'payorder',
              api: orderConfirmPay
            },
            selfDelery: {
              name: '自提',
              key: 'selfDelery',
              api: orderSelfDelery
            },
            delay: {
              name: '延期',
              key: 'delay',
              api: orderDelay
            },
            close: {
              name: '关闭',
              key: 'close',
              api: orderClose
            }
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 0
          }
        }
      }
    }
  },
  methods: {
    //请求表单接口
    formSubmitDetailbtn() {
      formSubmitDetail({ order_id: this.$route.query.order_id, user_id: this.$route.query.user_id }).then(res => {
        this.formSubmit = res.data.data
        //   this.formSubmit.pc_value.map(item =>{
        //         //    switch (item.key) {
        //         //         case 'singletext':
        //         //             this.defaults = item.default
        //         //             this.names = item.name
        //         //         break
        //         //          case 'manytext':
        //         //             this.hdefaults = item.default
        //         //             this.hnames = item.name
        //         //         break
        //         //     }

        //   })
      })
    },
    clickbtn() {
      if (this.formType === '3-1') {
        //使用dayjs处理时间
        const time = dayjs(this.end_time * 1000).add(this.formFormatData.formData.time[0], 'hour').add(this.formFormatData.formData.time[1], 'minute').add(this.formFormatData.formData.time[2], 'second').valueOf()
        orderDelay({ edit_time: time, type: 1, order_id: this.$route.query.order_id }).then(res => {
          const { data: { code, msg } } = res
          if (code == 1) {
            this.$message.success(msg)
            this.dialogTableVisible = false
          } else {
            this.$message.error(msg)
          }
        })
      } else {
        this.formFormatSubmit()
      }
    },
    hasFirst(data) {
      let result = []
      result = data.filter(item => {
        return item.value === 1
      })
      return result.length > 1
    },
    showDialog({ formType, params, is_abnormal,is_ticket,dealer_settled,express_type}) {
      console.log("sdfdfdfdfsdfdsfdsfsdfdsff000000000000",dealer_settled,express_type)
          this.transport_type = params.transport_type// 将params中的transport_type赋值给data中的transport_type
          this.is_abnormal = is_abnormal
          this.is_ticket = is_ticket
          this.express_type_data = express_type
          this.dealer_settled = dealer_settled
      this.formType = formType
      if (formType === '1') {
        this.formFormatData.api.submitForm = orderSend
      } else if (formType === '3') {
        this.formFormatData.api.submitForm = orderCheckCode
        shopIndex({ bus_id: params.bus_id, is_page: '2' }).then(res => {
          this.storeidData = res.data.data
        })
      } else if (formType === '3-1') {
        this.formFormatData.api.submitForm = orderDelay
      }else if(formType === '5'){
        this.formFormatData.api.submitForm = orderRefund
      }
      this.formFormatDialogEditEvt(params)
      if (this.isVerification) {
        this.verificationGet()
      }
    },
    formDialogEvt() {
      this.dialogTableVisible = true
    },
    verificationGet() {
      orderCodeList({ order_id: this.$detail.order_id, code: this.verificationSerch }).then((response) => {
        let { data: { data: msgData = [] } } = response
        if (msgData.length > 0) {
          msgData = msgData.filter(item => {
            return item.is_refund !== 30
          })
          this.verificationData = msgData
          this.formFormatData.formData.vercode_id = []
          msgData.map(item => {
            return this.end_time = item.end_time
          })
        }
      })
      getBusForGiftOrder({ order_id: this.$detail.order_id }).then((res) => {
        const { data: { data: msgData = [] } } = res
        if (msgData.length > 0) {
          this.formFormatData.formData.giftorder = msgData
        }
      })
    },
    verificationSelectionChange(rows) {
      const ids = []
      if (rows.length > 0) {
        rows.map(item => {
          ids.push(item.vercode_id)
        })
      }
      this.formFormatData.formData.vercode_id = ids
    },
    formFormatCallBack(data, type, response) {
      if (type === 'submitForm') {
        this.formFormatEditEvt()
      }
    },
    changeTableCallBack(response, site, params) {
      this.formFormatEditEvt()
    }
  }
}
</script>

<style lang="scss" scoped>
.ordersManagement-detail {
  /deep/ .kami-data .el-scrollbar__wrap {
    overflow-x: hidden;
  }

  .vercode-time {
    font-weight: 400;
    margin-left: 50px;
    font-size: 13px;
  }

  .logitem {
    border-bottom: 1px solid rgb(237, 237, 237);
    padding: 20px;

    .icon {
      margin-right: 8px;
    }

    .title {
      font-weight: 600;
      line-height: 30px;
    }

    .content {
      margin-left: 20px;
    }
  }

  .kami-line {
    width: 100%;
    height: 1px;
    margin-top: 10px;
    border-bottom: 1px solid rgb(237, 237, 237);
  }

  // .kami-box {
  // }

  .kami-box-item {
    line-height: 40px;
  }

  .form-group {
    .wlm-form {
      width: 500px;
      flex-grow: 1;
      margin-right: 20px;
    }
  }

  .total-money {
    font-size: 14px;
    // margin-bottom: 58px;

    .total-title {
      display: inline-block;
      text-align: right;
      width: 120px;
      margin-bottom: 18px;
      margin-right: 10px;
    }
  }

  .wlm-form {
    min-height: auto;

    .list-info {
      padding: 10px 0;
    }
  }

  .wlm-form-steps {
    padding-top: 30px;
    padding-bottom: 30px;
  }

  .send-type {
    margin-top: 15px;

    .el-button {
      padding: 20px 40px;

      & > span {
        & > p {
          font-weight: 600;
          margin-bottom: 15px;
        }

        & > span {
          display: inline-block;
          margin-bottom: 5px;
          color: #c3c3c3;
        }
      }
    }
  }
}
</style>
